<?php

/**
 * risque form base class.
 *
 * @method risque getObject() Returns the current form's model object
 *
 * @package    gesp
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaserisqueForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'rsq_id'          => new sfWidgetFormInputHidden(),
      'rsq_prj_id'      => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('projet'), 'add_empty' => true)),
      'rsq_cat_id'      => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('categorie'), 'add_empty' => true)),
      'rsq_description' => new sfWidgetFormTextarea(),
      'rsq_date_ident'  => new sfWidgetFormDate(),
      'rsq_gravite'     => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('gravite'), 'add_empty' => true)),
      'rsq_proba'       => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('probabilite'), 'add_empty' => true)),
      'rsq_impact'      => new sfWidgetFormTextarea(),
      'rsq_consequence' => new sfWidgetFormTextarea(),
      'rsq_tache'       => new sfWidgetFormInputText(),
      'rsq_planif_eval' => new sfWidgetFormInputText(),
      'rsq_date_eval'   => new sfWidgetFormDate(),
      'rsq_tendance'    => new sfWidgetFormInputText(),
      'rsq_date_app'    => new sfWidgetFormDate(),
    ));

    $this->setValidators(array(
      'rsq_id'          => new sfValidatorChoice(array('choices' => array($this->getObject()->get('rsq_id')), 'empty_value' => $this->getObject()->get('rsq_id'), 'required' => false)),
      'rsq_prj_id'      => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('projet'), 'required' => false)),
      'rsq_cat_id'      => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('categorie'), 'required' => false)),
      'rsq_description' => new sfValidatorString(array('max_length' => 2048, 'required' => false)),
      'rsq_date_ident'  => new sfValidatorDate(array('required' => false)),
      'rsq_gravite'     => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('gravite'), 'required' => false)),
      'rsq_proba'       => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('probabilite'), 'required' => false)),
      'rsq_impact'      => new sfValidatorString(array('max_length' => 1024, 'required' => false)),
      'rsq_consequence' => new sfValidatorString(array('max_length' => 1024, 'required' => false)),
      'rsq_tache'       => new sfValidatorInteger(array('required' => false)),
      'rsq_planif_eval' => new sfValidatorInteger(array('required' => false)),
      'rsq_date_eval'   => new sfValidatorDate(array('required' => false)),
      'rsq_tendance'    => new sfValidatorInteger(array('required' => false)),
      'rsq_date_app'    => new sfValidatorDate(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('risque[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'risque';
  }

}
